<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title>Document</title>
	<style>
		.box {
			width: 300px;
			height: 300px;
			background-color: #bbb;
			margin: 100px auto;
		}
	</style>
	<script src="./hammer.js"></script>
	<script>
		window.onload = function() {
			let oBox = document.querySelector('.box');
			let hammer = new Hammer(oBox);
			let old_scale;
			let scale = 0;

			hammer.get('pich').set({enable: true});

			hammer.on('pichstart', function(ev) {
				old_scale = scale;
			})

			hammer.on('pichmove', function(ev) {
				// ev.rotation就是本次旋转的角度
				scale = old_scale * ev.scale;
				oBox.style.transform = `rotate(${scale})`;
			})
		}
	</script>
</head>
<body>
	<div class="box"></div>
</body>
</html>